home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / pc / Demos / Herois / Codigo.Cst / 00057_Script_Message Sprite < prev    next >
Text File  |  1999-03-19  |  3KB  |  83 lines

  1. -- Message    Send to Sprite
  2.  
  3.  
  4. -- Messaging
  5. -- sends an event to a specified sprite on author selected event
  6. -- the the addressee does not handle the event, it goes to the cast member script
  7. -- then the frame script, then the movie script
  8.  
  9. -- EventToSend must be a symbol 
  10. -- whichEvent inits the action
  11. -- Addressee is the sprite (channel number) the event is going to
  12.  
  13. -- also functions through lingo by handling message 'initSendSprite', 
  14. -- for example if this behavior was assigned to sprite 5, use
  15. -- sendsprite 5, #initSendSprite
  16.  
  17. property whichEvent, addressee, eventToSend, params
  18.  
  19. on initSendSprite me
  20.   init me
  21. end
  22.  
  23. on mouseUp me
  24.   if whichEvent = #mouseup  then init me
  25. end
  26.  
  27. on mouseDown me
  28.   if whichEvent = #mousedown  then init me
  29. end
  30.  
  31. on prepareFrame me
  32.   if whichEvent = #prepareframe then init me
  33. end
  34.  
  35. on enterFrame me
  36.   if whichEvent = #enterframe  then init me
  37. end
  38.  
  39. on exitFrame me
  40.   if whichEvent = #exitframe  then init me
  41. end
  42.  
  43. on init me
  44.    set doit = "sendSprite the Addressee of me, the EventToSend of me," && params
  45.   do doit
  46. end
  47.  
  48. ---
  49.  
  50. on getPropertyDescriptionList  
  51.   
  52.   set p_list = [ ¼
  53.    #EventToSend: [ #comment:   "Message:", ¼
  54.                     #format:   #symbol, ¼
  55.                    #default:   #generic_event ], ¼
  56.    #Params:      [ #comment:   "Param1, param2, ...", ¼
  57.                     #format:   #string, ¼
  58.                    #default:   "" ], ¼
  59.   #Addressee: [ #comment:   "Target Sprite:", ¼
  60.                     #format:   #integer, ¼
  61.                    #default:    1 ], ¼
  62.     #WhichEvent: [ #comment:   "Initializing Event:", ¼
  63.                     #format:   #symbol, ¼
  64.                      #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitSendSprite], ¼
  65.                    #default:   #MouseUp ] ¼
  66.                  ]
  67.   return p_list  
  68.   
  69. end
  70.  
  71. on getBehaviorDescription
  72.   return ¼
  73. "Sends a message to the designated sprite when the specified event occurs.  Any behaviors attached to the target sprite that are triggered by the message will be executed." & RETURN & ¼
  74. "PARAMETERS:" & RETURN & ¼
  75. "ò Message - Enter the message to send to the target sprite."  & RETURN & ¼
  76. "ò Params  - Enter parameters to be sent with the message, seperated with commas."  & RETURN & ¼
  77. "ò Target Sprite - Enter the number of the sprite channel to which message should be sent."  & RETURN & ¼
  78. "ò Initializing Event - Specify the event that triggers the behavior." & RETURN & ¼
  79. "NOTES:" & RETURN & ¼
  80. "If there is no behavior attached to the target sprite that responds to the message being sent, the message is passed to the cast member script, the current frame script, and then movie scripts." 
  81.   
  82.   
  83. end